<?php
	$tool_buttons = array
	(
		'add_button' => array
		(
			'image'=>'btnNew.gif', 
			'text'=>LANG_ADD, 
			'attributes'=>'onClick="addTranslationRow();"'
		),
		'languages_button' => array
		(
			'image'=>'btnListLarge.gif', 
			'text'=>LANG_LANGUAGES,
			'url' => "/languages/",
		)
	);
	$this->helpers->htmlx->MenuText1(LANG_TRANSLATIONS.': '.LANG_LIST, "list.gif");	
	$this->helpers->toolbars->Toolbar($tool_buttons);
?>

<form action="/languages/editTranslation/<?php echo $this->data[lang]; ?>" method="post" name="trans">
<span class="success"><?php echo $this->data[out]; ?></span><br />
<table width="97%" border="0" class="translations" style="padding-left: 10px">
	<tr>
		<td align="right"><input name="submitTrans" type="submit" value="submit" class='submit'></td>
		<td align="left"><input name="reset" type="reset" value="reset" class='submit'></td>
	</tr>
	<tr style="display:none;" id="addTrans">
		<td class="" width="40%">
			<input onChange = "if (this.value.indexOf('LANG_') != 0) {alert('<?php echo LANG_INVALID_CONSTANT_NAME; ?>'); document.getElementById('transLabel').focus(); return false;} document.getElementById('transValue').name = this.value;" id = 'transLabel' name="" type="text" value="" style='width:95%;' class="text">
		</td>
		<td width=""><nobr>
			<input id = 'transValue' name="" type="text" value="" style='width:95%;' class="text" onchange="this.name = document.getElementById('transLabel').value">
			<img style='cursor: pointer;' id="img<?php echo $this->data[tr][$i][0]; ?>" src="<?php echo IMAGES ?>btnDelete.gif" onClick="document.getElementById('addTrans').style.display='none'" /></nobr>
		</td>
	</tr>
<?php
	for ($i=1; $i<$this->data[trans_num]; $i++)
	if ($this->data[tr][$i][0]."" != "")
	{
?>
	<tr>
		<td class="" width="40%"><?php echo $this->data[tr][$i][0]; ?></td>
		<td width=""><nobr>
			<input id="<?php echo $this->data[tr][$i][0]; ?>" name="<?php echo $this->data[tr][$i][0]; ?>" type="text" value="<?php echo $this->data[tr][$i][1]; ?>" style='width:95%;' class="text">
			<img style='cursor: pointer;' id="img<?php echo $this->data[tr][$i][0]; ?>" src="<?php echo IMAGES ?>btnDelete.gif" onClick="deleteTranslation('<?php echo $this->data[tr][$i][0]; ?>');" /></nobr>
		</td>
	</tr>
<?php
	}
?>
	<tr>
		<td align="right"><input name="submitTrans" type="submit" value="submit" class='submit'></td>
		<td align="left"><input name="reset" type="reset" value="reset"  class='submit'></td>
	</tr>
</table>
</form>
<script>
	function addTranslationRow()
	{
		tag = document.getElementById('addTrans');
		tag.style.display = '';
		//document.getElementById('transLabel').focus();
	}
	
	function deleteTranslation(id)
	{
		elem = document.getElementById(id);
		img = document.getElementById('img'+id);
		if (elem.disabled) 
		{
			elem.removeAttribute('disabled');
			img.src = '<?php echo IMAGES ?>'+'btnDelete.gif';
		}
		else 
		{
			elem.disabled='disabled';
			img.src = '<?php echo IMAGES ?>'+'btnAddChild.gif';
		}
	}
</script>